package com.alu.sg.calendar.calendar.manager;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import com.alu.sg.calendar.calendar.view.WeekView;

import java.util.List;


/**
 * Created by Alu on 2017/10/26.
 * version 1.0
 */

public class TopViewPagerAdapter extends PagerAdapter {

    List<WeekView> list;

    public TopViewPagerAdapter(List<WeekView> list) {
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public boolean isViewFromObject( View view, Object arg1) {
        return (WeekView)view == arg1;
    }

    @Override
    public void destroyItem(ViewGroup view, int position, Object object) {
        view.removeView(list.get(position));
    }

    @Override
    public Object instantiateItem(ViewGroup view, int position) {
        view.addView(list.get(position));
        return list.get(position);
    }
}
